home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / file211.zip / FILEDEF.PAS < prev    next >
Pascal/Delphi Source File  |  1993-04-07  |  21KB  |  564 lines

  1.  
  2. { FILEDEF.LIB                                }
  3. { File Definitions for Searchlight BBS 2.0   }
  4.  
  5. { (C) Copyright 1990 by Frank LaRosa. ALL RIGHTS RESERVED.
  6.       No part of this source code may be reproduced in any form,
  7.       including compiled form, without the written permission of
  8.       the author.                                                   }
  9.  
  10.  
  11. { The following files make up the core of the BBS. They will
  12.   reside in the current directory when the BBS is run. }
  13.  
  14. Unit Filedef;
  15.  
  16. Interface
  17.  
  18. {$I BLOCK.PAS}
  19.  
  20. const logsize   =  75;  { size of last caller log }
  21.       chatsize  =   4;  { chat queue size - 1 }
  22.       ulistmax  =  50;  { upload list size }
  23.       maxproto  =  15;  { number of external protocols }
  24.  
  25.  
  26. const { Message File Constants }
  27.       indexsize = 1024;       { size of index hash table }
  28.       blocksize = 250;        { text block size }
  29.  
  30.  
  31. const configspec  = 'CONFIG.SL2';   { Configuration Info }
  32.       nodesspec   = 'NODES.SL2';    { Node Information }
  33.  
  34.       chatspec    = 'CHAT.SL2';     { Chat File }
  35.       logspec     = 'LOG.SL2';      { Caller Log }
  36.  
  37.       subspec     = 'SUBBOARD.SL2'; { Subboard Definitions }
  38.       dirspec     = 'FILEDIR.SL2';  { UL/DL Directory Definitions }
  39.       doorspec    = 'DOORS.SL2';    { External Program Definitions }
  40.  
  41.       msysspec: string[80]
  42.                   = 'STRINGS.SYS';  { Offline Message Strings }
  43.  
  44.       ulistspec   = 'UPLIST.SL2';   { Batch Upload Description List }
  45.  
  46.       configpath: string[60] = '';
  47.         { path to CONFIG file }
  48.  
  49.  
  50. Type  { -- Preliminary Type Definitions ------------------------------------ }
  51.  
  52.      rsbaud = byte;
  53.      ansitype = (GENERIC,PROCOMM,STANDARD);
  54.      helplevel = (EXPERT,INTERMEDIATE,NOVICE);
  55.  
  56.      IxType = (SEQ,UID,MAIL);
  57.        { index type, seqential/universal/mail }
  58.  
  59.      filetype = (CONFIGF,NODESF,CHATF);
  60.      fileset = set of filetype;
  61.  
  62.      timetype = record   { time }
  63.        hour: byte;
  64.        minute: byte;
  65.      end;
  66.  
  67.      datetype = record   { date }
  68.        year: byte;
  69.        month: byte;
  70.        day: byte;
  71.      end;
  72.  
  73.      pwtype = array[1..3] of byte;  { 3-byte password }
  74.  
  75.      maillogtype = (MLOFF,MLON,MLTAP);
  76.  
  77.      attribtype = 1..24;
  78.      attribset = set of attribtype;    { access attribute set A-X }
  79.  
  80.      ExProtocol = record
  81.        name: string[40];      { protocol name }
  82.        sendcmd: string[72];   { send command }
  83.        rcvcmd: string[72];    { receive command }
  84.        extra: string[20];     { expansion room }
  85.      end;
  86.  
  87.      ColorType = (NULLCOLOR,     { no color set }
  88.                   NORMAL,        { normal screen color for most i/o }
  89.                   INVERSE,       { foreground color for input highlighting }
  90.                   BACKGROUND,    { background color for input highlighting }
  91.                   COMCOLOR,      { color for command highlight }
  92.                   SUBCOLOR,      { subboard information }
  93.                   HEADCOLOR,     { color for headings }
  94.                   CHATCOLOR,     { chat mode color }
  95.                   SPECIAL,       { special prompts and messages }
  96.                   ERRCOLOR,      { error and warning messages }
  97.                   ALTCOLOR,      { alt. special color }
  98.                   PROMPTCOLOR ); { colour for prompts }
  99.  
  100.      MsgType = record    { inter-terminal message }
  101.        from: integer;         { node where from }
  102.        name: string[25];      { name of sender }
  103.        message: string[73];   { text of msg }
  104.      end;
  105.  
  106.      AutoDoorType = record   { automatic door }
  107.        command: string[60];
  108.        directory: string[60];
  109.        commtype: byte;
  110.        abort: byte;
  111.        writeprot: boolean;
  112.        extra: string[10];
  113.      end;
  114.  
  115.      PortDefType = record   { COM port definition }
  116.        PortType: byte;        { type of port; 0=standard }
  117.        BaseAddress: word;     { base address }
  118.        IRQ: word;             { interrupt }
  119.        Num: byte;             { physical port number }
  120.        extra: string[7];      { extra bytes }
  121.      end;
  122.  
  123.      AccessType = record   { access level set }
  124.        attrib: attribset;    { attributes }
  125.        msglevel: integer;    { message system access level }
  126.        filelevel: integer;   { file system access level }
  127.        ratio: byte;          { download:upload ratio }
  128.        timelimit: integer;   { daily time limit }
  129.        sesslimit: integer;   { per session time limit }
  130.        expiredate: datetype; { expiration date }
  131.      end;
  132.  
  133.      AccessDefType = record
  134.        name: string[20];     { name of access level }
  135.        days: integer;        { # of days added to expiration date }
  136.        a: accesstype;        { access levels }
  137.      end;
  138.  
  139.  
  140.  
  141.  
  142. Type  { -- CONFIG, NODES and CHAT file types ------------------------------- }
  143.  
  144.      configtype = record   { format of CONFIG file }
  145.  
  146.        systemname: string[30]; { the name of the BBS }
  147.        sysopname: string[25];  { sysop's name }
  148.        node: integer;          { node number this node }
  149.        maxnode: integer;       { total number of nodes }
  150.        version: integer;       { version of SLBBS program in use }
  151.  
  152.        progpath: string[45];   { path to program files }
  153.        altprogpath: string[45];{ alternate program path }
  154.        datapath: string[45];   { path to data files }
  155.        chatpath: string[45];   { path to chat.bbs }
  156.        textpath: string[45];   { path to text files }
  157.        incpath: string[45];    { path to user include files }
  158.        mailpath: string[45];   { path for MAIL.LOG files }
  159.        alogspec: string[45];   { activity log filespec }
  160.        flogspec: string[45];   { files log filespec }
  161.        logfile: string[45];    { default general log file }
  162.        sysfile: string[45];    { path/filename for pcboard.sys file }
  163.        defaultpw: string[45];  { default password for uploads }
  164.        presshard: byte;        { reserved }
  165.  
  166.        curruser: longint;      { current user ID number }
  167.        currsub: string[8];     { current/last used message area }
  168.        currdir: string[8];     { current/last used file area }
  169.        lastdoor: string[45];   { current/last door menu executed }
  170.        logtime: timetype;      { time current user logged on }
  171.        laston: datetype;       { last logon date of current user }
  172.        remote: boolean;        { set if remote logon }
  173.        rsactive: boolean;      { set if rs port active }
  174.        baudrate: rsbaud;       { caller's actual effective baud rate }
  175.        errorfree: boolean;     { set if error free connect detected }
  176.        ansi: boolean;          { caller's ANSI graphics mode }
  177.        color: boolean;         { caller's color mode indicator }
  178.        timelimit: integer;     { caller's time limit for this session }
  179.        newlogon: boolean;      { set if main program not yet run }
  180.  
  181.        sysavail: boolean;      { set if sysop is available }
  182.        sysopnext: boolean;     { set if sysop will be next login }
  183.        paged: boolean;         { set if sysop was paged }
  184.        superuser: boolean;     { set if superuser key (alt-s) pressed }
  185.  
  186.        newusers: boolean;      { new user registration? }
  187.        reginfo: word;          { registration info to collect? }
  188.        minaccess: byte;        { min. access lev req. for login }
  189.        noquotes: boolean;      { set if Quotes are Off }
  190.        inithelp: helplevel;    { initial help level }
  191.        partreg: boolean;       { collect partial user info? }
  192.  
  193.        comport: byte;          { com port to use }
  194.        bsupport: byte;         { baud rates supported }
  195.        initstr: string[45];    { modem 'remote' init string }
  196.        localstr: string[45];   { modem 'local' init string }
  197.        buffactor: integer;     { output buffer size }
  198.        bufferdoors: boolean;   { buffer DOOR output? }
  199.        modemmsg: boolean;      { true for modem msg baud detect }
  200.        flowcntrl: boolean;     { set for harware cts/dsr flow control }
  201.        lockedbaud: rsbaud;     { baud rate to lock modem at }
  202.        hardbreak: boolean;     { if set, bbs uses hard modem breaks }
  203.  
  204.        directvid: boolean;     { direct screen/BIOS output switch }
  205.        dateformat: byte;       { desired date format }
  206.        timeformat: byte;       { desired time format }
  207.        payback: byte;          { upload time payback }
  208.        romcopy: boolean;       { set for ROM file copies }
  209.        userpriv: boolean;      { set if user lists are private }
  210.        PauseSource: byte;      { source for pause routine (dos/bios/ram) }
  211.  
  212.        command: string[255];   { next command executed by slbbs.exe }
  213.        commtype: byte;         { next command type }
  214.        commdir: string[80];    { default dir for command }
  215.        wp: boolean;            { write protection for command }
  216.        abort: byte;            { abort type for command }
  217.        doorflag: byte;         { program to run on return from door }
  218.        keyflag: boolean;       { set if "press return" desired }
  219.        indoors: boolean;       { set if a doors menu is active }
  220.  
  221.        relog: boolean;         { relog flag }
  222.        lastevent: integer;     { line number of last event }
  223.        lastday: byte;          { day last event executed }
  224.        nextevent: integer;     { time until next system event (-1=None) }
  225.        eventsoon: boolean;     { set if event scheduled after current session }
  226.        idletime: byte;         { idle time limit }
  227.  
  228.        lastactive: boolean;    { set if lastuser currently logged in }
  229.        host: boolean;          { if set, return to DOS on logout }
  230.        hangup: boolean;        { if set, hang up after each call }
  231.        disablekeys: boolean;   { if set, hot keys are disabled }
  232.  
  233.        AccessDef: array[1..25]
  234.          of AccessDefType;     { access level definitions }
  235.  
  236.        Colorchart: array [NORMAL..PROMPTCOLOR]
  237.          of byte;              { color definitions }
  238.  
  239.        PortDef: array[1..8]
  240.          of PortDefType;       { COM port setup info }
  241.  
  242.        Ex: array[1..MaxProto]
  243.          of exprotocol;        { external protocols setup }
  244.  
  245.        Autodoors: array[1..3] of autodoortype;
  246.  
  247.        mainlevels: array[1..30] of byte;
  248.          { access levels for main menu }
  249.  
  250.        fileslevels: array[1..30] of byte;
  251.          { access levels for files menu }
  252.  
  253.        ftime: timetype;        { start of xfer time }
  254.        fdisc: char;            { disconnect from external xfer }
  255.  
  256.        fileset: string[60];
  257.          { name of DIR file to use upon startup }
  258.  
  259.        extra: array[1..936] of byte;    { extra space for future expansion }
  260.  
  261.      end;
  262.  
  263.  
  264. type nodetype = record    { NODES file }
  265.  
  266.        syscalls: longint;      { record 0: total calls to system }
  267.        lastuser: longint;      { record 0: last user on the system }
  268.        lastquote: string[72];  { record 0: quote left by last user }
  269.  
  270.        name: string[25];       { logged user's name }
  271.        id: longint;            { logged user's id }
  272.        stat: byte;             { logged user's chat status }
  273.        savestat: byte;         { saved status from door or ext. proto. }
  274.  
  275.        extra: string[14];      { pad to 128 bytes }
  276.  
  277.      end;
  278.  
  279.  
  280. type chattype = record      { CHAT.BBS file }
  281.  
  282.        head,tail: byte;          { head, tail of msg queue }
  283.        msg: array[0..chatsize]   { up to four messages }
  284.          of msgtype;
  285.  
  286.      end;
  287.  
  288.  
  289.  
  290. { -- USER file ----------------------------------------------------------- }
  291.  
  292.  
  293. type UserHeader = record       { file header info }
  294.        root: TreeRootType;       { tree root info }
  295.        pad: array[1..116] of byte;
  296.      end;
  297.  
  298.  
  299.      Usertype = record
  300.        Leaf: TreeLeafType;     { tree leaf info }
  301.  
  302.        name: string[25];       { user's real name }
  303.        alias: string[25];      { user's alias name }
  304.        passwd: pwtype;         { password }
  305.        cksum: integer;         { checksum of name }
  306.  
  307.        firston: datetype;      { date of first logon }
  308.        laston: datetype;       { date of last logon }
  309.        lasttime: timetype;     { time of last logon }
  310.        calls: longint;         { total number of calls }
  311.  
  312.        location: string[20];   { user's location }
  313.        systype: string[15];    { system type }
  314.        phoneno: string[12];    { phone number }
  315.        extra: string[51];      { extra space }
  316.        subboard: string[8];    { current or last used subboard }
  317.  
  318.        xproto: byte;           { default file xfer protocol }
  319.        logmail: maillogtype;   { log mail sent/rcv'd }
  320.        scrnsize: byte;         { screen size (0=continuous scroll) }
  321.        help: helplevel;        { help level }
  322.        ansimode: ansitype;     { default ANSI mode }
  323.  
  324.        access: accesstype;     { access & time limits }
  325.        timeleft: integer;      { time left today }
  326.  
  327.        uploads: longint;       { Kbytes uploaded }
  328.        ulcount: longint;       { File upload count }
  329.        downloads: longint;     { Kbytes downloaded }
  330.        dlcount: longint;       { File download count }
  331.  
  332.        listformat: byte;       { file list format prompt/short/long }
  333.  
  334.        pad: array[1..19] of byte;   { pad to 256 bytes }
  335.  
  336.      end;
  337.  
  338.  
  339.  
  340. { -- Setup Files ------------------------------------------------------------ }
  341.  
  342. type SetupHeader = record
  343.        root: TreeRootType;       { tree root info }
  344.        pad: string[116];         { header for subboard/filedir SETUP files }
  345.      end;
  346.  
  347.      SetupData = record             { data for SETUP files }
  348.        Leaf: TreeLeafType;     { tree leaf info }
  349.        name: string[8];        { eight-char item name }
  350.        path: string[40];       { path to HDR/DIR file }
  351.        descrip: string[40];    { name of subboard/file area }
  352.        access: integer;        { access level required to use }
  353.        attrib: attribset;      { attributes required to read/join }
  354.  
  355.        case integer of
  356.          1: (                { Subboards }
  357.          subsysop: string[25];   { subop's name }
  358.          echomail: boolean;      { echomail attrib for subboards }
  359.          postattrib: attribset;  { attributes required to post }
  360.          visible: boolean;       { subboard visible? }
  361.          pad: string[13]);       { extra bytes }
  362.  
  363.          2: (                { Filedirs }
  364.          filepath: string[38];   { path to upload/download files }
  365.          readonly,
  366.          writeonly: boolean;
  367.          Free: word;
  368.          Value: integer;
  369.          display: boolean);      { subboard visible? }
  370.  
  371.      end;
  372.  
  373.  
  374.  
  375. { -- Message Files ---------------------------------------------------------- }
  376.  
  377. type SubType = record   { subboard header information }
  378.        access: integer;        { access level required to use subboard }
  379.        attrib: attribset;      { attributes required to read/join }
  380.        name: string[40];       { long sub board name }
  381.        subsysop: string[25];   { sub-sysop's name }
  382.        maxsize: longint;       { maximum number of msgs allowed }
  383.        maxmsglen: integer;     { max. message length }
  384.        anonymous: boolean;     { set if anonymous posts are allowed }
  385.        echomail: boolean;      { set if echomail on this subboard }
  386.        autokill: boolean;      { purge old messages automatically }
  387.        compress: boolean;      { set to compress message texts }
  388.  
  389.        messages: longint;      { number of active headers }
  390.        nextid: longint;        { next MSG ID number }
  391.  
  392.        firstmsg,
  393.        lastmsg: longint;       { first & last active msg by ID # }
  394.  
  395.        orignode: word;         { originating node, for echomail }
  396.        orignet: word;          { originating net, for echomail }
  397.        origzone: word;         { originating zone, for echomail }
  398.        origpoint: word;        { originating point }
  399.  
  400.        userjoin: boolean;      { set if users allowed to join }
  401.        postattrib: attribset;  { attributes required to post msgs }
  402.        visible: boolean;       { false hides subboard from list }
  403.  
  404.        pad: string[14];        { pad to 128 bytes }
  405.  
  406.      end;
  407.  
  408.  
  409.      IndexType = array [SEQ..UID,0..IndexSize-1]
  410.        of longint;           { index for sequential and uid values }
  411.  
  412.  
  413.      HeaderType = record        { message header }
  414.        status: byte;         { 0=header, 255=deleted }
  415.        id: array[SEQ..UID]
  416.          of longint;         { sequential and universal ID numbers }
  417.        next: array[SEQ..UID]
  418.          of longint;         { pointers to next headers if any }
  419.        txt: longint;         { pointer to start of text in text file }
  420.  
  421.        from: string[25];     { text of sender's name }
  422.        fromid: longint;      { sender's user record, if local }
  423.        touser: string[25];   { text of receiver's name }
  424.        toid: longint;        { receiver's user record, if local }
  425.        subj: string[40];     { subject }
  426.  
  427.        time: timetype;       { time recorded }
  428.        date: datetype;       { date recorded }
  429.        rd: longint;          { times read }
  430.        replies: longint;     { times replied-to }
  431.  
  432.        ffrom: string[40];    { forwarded-from }
  433.        extra: string[19];    { extra heading information }
  434.  
  435.        prot: boolean;        { purge protection }
  436.        logged: boolean;      { set if mail logged to disk }
  437.  
  438.        lastseq,
  439.        nextseq: longint;     { next/previous sequential message }
  440.  
  441.        lastthread,
  442.        nextthread: longint;  { next/previous threaded message }
  443.  
  444.        topthread,            { first msg in this thread }
  445.        lastreply,            { last reply to this message }
  446.        replyto: longint;     { message to which this is a direct reply }
  447.  
  448.        lastmail,
  449.        nextmail: longint;    { next/previous personal mail message }
  450.  
  451.        attribute: word;      { netmail flags/attributes }
  452.  
  453.        pad: string[19];   { pad to 256 bytes }
  454.      end;
  455.  
  456.  
  457.      TextHeader = record     { header info for message file }
  458.        pad: string[127];
  459.      end;
  460.  
  461.      TexType = record        { block of text from text file }
  462.        copies: byte;              { #of copies 255=deleted }
  463.        data: string[blocksize];   { block of text }
  464.        next: longint;             { pointer to next block }
  465.      end;
  466.  
  467.  
  468.      MembHeader = record      { header for member file }
  469.        root: treeroottype;
  470.        pad: string[116];
  471.      end;
  472.  
  473.      MembType = record        { block data for member file }
  474.        Leaf: treeleaftype;
  475.        name: string[25];      { member's name }
  476.        firston: datetype;     { date joined this subboard }
  477.        laston: datetype;      { date last accessed this subboard }
  478.        lastread: longint;     { highest message read }
  479.        firstmail,
  480.        lastmail: longint;     { first/last personal message this subboard }
  481.        pad: string[66];
  482.      end;
  483.  
  484.  
  485. { -- Log and Quotes Files ------------------------------------------------- }
  486.  
  487. type logtype = record  { LOG file }
  488.        head: integer;
  489.        users: array[1..logsize] of record
  490.          id: longint;     { user ID # }
  491.          chksum: integer; { user checksum }
  492.          time: timetype;  { time of login }
  493.          date: datetype;  { date of login }
  494.        end;
  495.      end;
  496.  
  497.      logfiletype = file of logtype;
  498.  
  499.  
  500. type quotehead = record
  501.        head: longint;
  502.        tail: longint;
  503.        pad: string[7];
  504.      end;
  505.  
  506.      quotetype = record
  507.        status: byte;
  508.        name: string[25];    { their name }
  509.        quote: string[72];   { what they said }
  510.        time: timetype;      { when they said it }
  511.        date: datetype;
  512.        pad: string[22];
  513.      end;
  514.  
  515.  
  516.  
  517. { -- File Directories ------------------------------------------------------ }
  518.  
  519. type DirHeader = record    { File directory header info }
  520.        root: treeroottype;     { root information }
  521.  
  522.        access: byte;           { access level required to use directory }
  523.        attrib: attribset;      { attributes required to use/upload }
  524.        name: string[40];       { long directory name }
  525.        visible: boolean;       { directory visible? }
  526.        subsysop: string[25];   { directory subsysop }
  527.  
  528.        filepath: string[45];   { path to files }
  529.        maxsize: word;          { max number of files allowed }
  530.        autokill: boolean;      { auto kill oldest files }
  531.        readonly: boolean;      { read only dir }
  532.        writeonly: boolean;     { write only dir }
  533.        free: longint;          { free files limit }
  534.        value: integer;         { value multiplier }
  535.        dlattrib: attribset;    { attributes required to download }
  536.  
  537.        pad: array[1..110] of byte;   { pad to 256 bytes }
  538.      end;
  539.  
  540.  
  541.      DirType = record      { File directory record format }
  542.        leaf: treeleaftype;     { tree/list leaf data }
  543.  
  544.        name: string[12];       { filename }
  545.        descrip: string[40];    { description }
  546.        edescrip: array[1..2]
  547.          of string[60];        { extended description }
  548.        spare: byte;            { spare byte }
  549.        length: longint;        { length in 128-char blocks }
  550.        id: longint;            { ID of uploader }
  551.        cksum: integer;         { checksum of uploader }
  552.        date: datetype;         { date uploaded }
  553.        times: longint;         { # of times downloaded }
  554.        passwd: pwtype;         { password }
  555.        offline: boolean;       { flag if file not available }
  556.  
  557.        pad: array[1..41] of byte;    { pad to 256 bytes }
  558.      end;
  559.  
  560.  
  561.  
  562. Implementation
  563.  
  564. end.